﻿(function ($) {
    oo('class', {
        prop: [
            'data', 'info', 'error', 'warning',
            {
                name: 'callback', value: function (json) {
                    var callback;
                    (callback = this.prop(json.type)) && callback(json.data);
                }
            },
            { name: 'module', isStatic: true },
            'method',
            { name: 'extension', value: 'do', isStatic: true },
            { name: 'dparameterata', value: {} },
            {
                name: 'url',
                value: '',
                getter: function (owner) {
                    return [owner.prop('module'), owner.prop('method'), owner.prop('extension')].join('.');
                }
            },
            { name: 'dataType', value: 'json' }
        ],
        _ajax: function (method, data) {
            this.prop('method', method);
            data && this.prop('parameter', data);
        },
        request: function () {
            $.ajax({
                url: this.prop('url'),
                type: 'POST',
                data: this.prop('parameter'),
                async: true,
                cache: false,
                dataType: this.prop('dataType'),
                error: function (a, b, c) {
                    console.log('error');
                    //此处预留用于再次提交服务器制作LOG提醒程序此处返回的JSON有异常,无法编译.
                },
                success: (function (self) {
                    return function (json) {
                        self.prop('callback').call(self, json);
                    };
                })(this)
            });
        }
    });
})(jQuery);